import { AppSubProportionReq } from '../../tenant-opertation/app-subscription-analysis/model/appSubscriptionModel';
import {
  AppActiveUserNumByArchTypeMap,
  AppActiveUserNumByArchTypeParams,
  AppActiveUserNumByTenantMap,
  AppActiveUserNumByTenantParams,
  AppActiveUserNumInTotalMap,
  AppActiveUserNumInTotalParams,
  AppArchAndPackageTypeResp,
  MaturityTenantListPageParams,
  MaturityTenantPageResult,
} from './model/subscriptionAnalysisModel';
import { operationHttp } from '/@/utils/http/axios';

enum Api {
  GET_MATURITY_TENANT_NUM_BY_APP = '/v1/subAnalysis/getTenantMaturityAna',
  GET_CERTAIN_MATURITY_TENANT_LIST = '/v1/subAnalysis/getTenantList',
  GET_APP_ACTIVE_USER_NUM_IN_TOTAL = '/v1/subAnalysis/getAppActiveUsersSummary',
  GET_APP_ACTIVE_USER_NUM_BY_TENANT = '/v1/subAnalysis/getAppActiveUsersByTenant',
  GET_APP_ACTIVE_USER_NUM_BY_ARCH_TYPE = '/v1/subAnalysis/getAppActiveUsersByArc',
  GET_ARCHITECTURE_AND_PACKAGETYPE = '/v1/subAnalysis/getArcAndType',
}

export const getMaturityTenantNumByApp = (params: AppSubProportionReq) => {
  return operationHttp.get<number[]>({ url: Api.GET_MATURITY_TENANT_NUM_BY_APP, params });
};

export const getCertainMaturityTenantList = (params: MaturityTenantListPageParams) => {
  return operationHttp.get<MaturityTenantPageResult>({
    url: Api.GET_CERTAIN_MATURITY_TENANT_LIST,
    params,
  });
};

export const getAppActiveUserNumInTotal = (params: AppActiveUserNumInTotalParams) => {
  return operationHttp.get<AppActiveUserNumInTotalMap[]>({
    url: Api.GET_APP_ACTIVE_USER_NUM_IN_TOTAL,
    params,
  });
};

export const getAppActiveUserNumByTenant = (params: AppActiveUserNumByTenantParams) => {
  return operationHttp.get<AppActiveUserNumByTenantMap[]>({
    url: Api.GET_APP_ACTIVE_USER_NUM_BY_TENANT,
    params,
  });
};

export const getAppActiveUserNumByArchType = (params: AppActiveUserNumByArchTypeParams) => {
  return operationHttp.get<AppActiveUserNumByArchTypeMap[]>({
    url: Api.GET_APP_ACTIVE_USER_NUM_BY_ARCH_TYPE,
    params,
  });
};

export const getArchAndType = () => {
  return operationHttp.get<AppArchAndPackageTypeResp>({
    url: Api.GET_ARCHITECTURE_AND_PACKAGETYPE,
  });
};
